home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 526-550 / disk_543 / wbplane / subwbplane.asm < prev    next >
Assembly Source File  |  1992-05-06  |  2KB  |  111 lines

  1.  
  2. *    SubWBplane
  3. *
  4. *    Subtracts a bitplane from the Workbench screen.
  5. *
  6. *
  7. *HISTORY
  8. *         Made with Hisoft V2.12
  9. *  V1.0   27-Jun-91: First attempt. Works of course
  10.  
  11.     OPT O+
  12.     OPT O1+        ; Tells when a branch could be optimised to short
  13.     OPT i+        ; Tells when '#' is probably missing
  14.  
  15.     incdir        "AsmInc:"
  16.     include        "P.i"
  17.     include        "relMacros.i"
  18.     include        "exec/exec_lib.i"
  19.     include        "libraries/dosextens.i"
  20.     include        "graphics/graphics_lib.i"
  21.     include        "intuition/intuition_lib.i"
  22.     include        "intuition/intuition.i"
  23.  
  24. Planes        EQUR        D2
  25. Index        EQUR        D3
  26. WScreen        EQUR        A2
  27. WBitMap        EQUR        A3
  28. DB        EQUR        A4
  29.  
  30.  dcDeclare    A4
  31.  dcAPtr        WBMsg
  32.  dcAPtr        GraphBase
  33.  dcAPtr        IntuiBase
  34.  dcEnd
  35. Start        dcAlloc
  36.         dcReset
  37.         Prepare        Exec_Call
  38.         suba.l        A1,A1
  39.         CallLib        FindTask        ; Find us
  40.         movea.l        D0,A2
  41.         tst.l        pr_CLI(A2)
  42.         bne.S        GetLibs
  43. WBStart        lea        pr_MsgPort(A2),A0
  44.         CallLib        WaitPort        ; wait for a message
  45.         lea        pr_MsgPort(A2),A0
  46.         CallLib        GetMsg            ; then get it
  47.         move.l        D0,WBMsg(DB)        ; save it for later reply
  48. GetLibs        lea        GfxName(PC),A1
  49.         CallLib        OldOpenLibrary
  50.         move.l        D0,GraphBase(DB)
  51.         beq.S        Error
  52.         lea        IntuiName(PC),A1
  53.         CallLib        OldOpenLibrary
  54.         move.l        D0,IntuiBase(DB)
  55.         beq.S        Error
  56. *»»» Find Workbench screen
  57.         CallLib        Forbid
  58.         move.l        IntuiBase(DB),A0
  59.         move.l        ib_FirstScreen(A0),WScreen
  60. 1$        move.l        WScreen,D0
  61.         beq.S        3$
  62.         move.w        sc_Flags(WScreen),D0
  63.         andi.w        #SCREENTYPE,D0
  64.         cmpi.w        #WBENCHSCREEN,D0    ; Workbench screen ?
  65.         beq.S        2$
  66.         move.l        sc_NextScreen(WScreen),WScreen
  67.         bra.S        1$
  68. *»»» Found Workbench screen
  69. 2$        lea        sc_BitMap(WScreen),WBitMap
  70.         moveq        #0,Planes
  71.         move.b        bm_Depth(WBitMap),Planes
  72.         subq.w        #1,Planes
  73.         beq.S        3$
  74.         move.b        Planes,bm_Depth(WBitMap)
  75.         move.w        Planes,Index
  76.         mulu        #4,Index
  77.         move.l        bm_Planes(WBitMap,Index),A0
  78.         clr.l        bm_Planes(WBitMap,Index)
  79.         move.w        sc_Width(WScreen),D0
  80.         move.w        sc_Height(WScreen),D1
  81.         Prepare        Gfx_Call
  82.         CallLib        FreeRaster
  83.         Prepare        Intuition_Call
  84.         CallLib        RemakeDisplay
  85. 3$        Prepare        Exec_Call
  86.         CallLib        Permit
  87.  
  88. Error
  89. Exit        Prepare        Exec_Call
  90. FreeIntui    move.l        IntuiBase(DB),D0
  91.         beq.S        FreeGfx
  92.         move.l        D0,A1
  93.         CallLib        CloseLibrary
  94. FreeGfx        move.l        GraphBase(DB),D0
  95.         beq.S        ReplyWB
  96.         move.l        D0,A1
  97.         CallLib        CloseLibrary
  98. ReplyWB        move.l        WBMsg(DB),D2
  99.         beq.S        AllDone
  100.         CallLib        Forbid            ; We were started from WB
  101.         movea.l        D2,A1
  102.         CallLib        ReplyMsg        ; Reply WBMessage
  103. AllDone        dcFree
  104.         moveq        #0,D0
  105.         rts
  106.  
  107. GfxName        dc.b        'graphics.library',0
  108. IntuiName    dc.b        'intuition.library',0
  109.         END
  110.  
  111.